package cn.hill4j.tool.spring.ext.iop;

import org.springframework.beans.factory.FactoryBean;

/**
 * ClassName: BaseIopClientBuilder
 * Description: iopClient构成器接口
 * @author hillchen
 * Date: 2023/8/12
 * @version: 1.0
 */
public interface IopClientBuilder extends FactoryBean<Object> {
    @Override
    default Object getObject() throws Exception {
        return buildClient();
    }
    @Override
    default Class<?> getObjectType() {
        return getInterfaceClazz();
    }
    /**
     * @author hillchen
     * Description: 构造iopClient
     * Date: 2023/8/12 23:29
     * @param <T> iopClient接口类型
     * @return T
     **/
    <T> T buildClient();
    /**
     * @author hillchen
     * Description: 获取iopClient接口类型
     * Date: 2023/8/12 23:30
     * @param <T> iopClient接口类型
     * @return Class
     **/
    <T> Class<T> getInterfaceClazz();
    /**
     * @author hillchen
     * Description: 设置iopClient接口类型
     * Date: 2023/8/12 23:30
     * @param <T> iopClient接口类型
     * @param interfaceClazz iopClient接口类型
     **/
    <T> void setInterfaceClazz(Class<T> interfaceClazz);
    /**
     * @author hillchen
     * Description: 构造iopClient命令空间上下文id
     * Date: 2023/8/12 23:31
     * @return String
     **/
    default String contextId(){
        return "#iop." + getInterfaceClazz().getSimpleName();
    }
}
